package com.yzc.mihuyou.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yzc.mihuyou.entity.Ingvse;
import com.yzc.mihuyou.entity.Topic;
import com.yzc.mihuyou.mapper.IngvseMapper;
import com.yzc.mihuyou.mapper.TopicMapper;
import com.yzc.mihuyou.service.IngvseService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 帖子和话题 服务实现类
 * </p>
 *
 * @author 易紫诚
 * @since 2022-04-28
 */
@Service
public class IngvseServiceImpl extends ServiceImpl<IngvseMapper, Ingvse> implements IngvseService {
    @Autowired
    IngvseMapper ingvseMapper;

    @Override
    public Ingvse selTope(int invition_id) {
        QueryWrapper<Ingvse> queryWrapper=new QueryWrapper();
        queryWrapper.eq("invition_id",invition_id);
        if(ingvseMapper.selectOne(queryWrapper)==null){
            return  new Ingvse();
        }
        return ingvseMapper.selectOne(queryWrapper);
    }

    @Override
    public int addTope(Ingvse ingvse) {
        return ingvseMapper.insert(ingvse);
    }
}
